/**   
* @Title: AJAXRender.java
* @Package com.jbeer.framework.web.viewrender
* @author Bieber
* @date 2014-5-11 下午12:16:28
* @version V1.0   
*/

package com.jbeer.framework.web.viewrender;

import java.io.Writer;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jbeer.framework.JBeer;
import com.jbeer.framework.exception.RenderingViewException;
import com.jbeer.framework.web.ModelAndView;

/**
 * <p>类功能说明:TODO</p>
 * <p>类修改者	    修改日期</p>
 * <p>修改说明</p>
 * <p>Title: AJAXRender.java</p>
 * @author Bieber <a mailto="bieber.jbeer@hotmail.com">bieber.jbeer@hotmail.com</a>
 * @date 2014-5-11 下午12:16:28
 * @version V1.0
 */

public class AJAXRender  {
	 public static void render(HttpServletRequest request,HttpServletResponse response,ModelAndView modelView) throws RenderingViewException{
	        try{
	            if(modelView.getContent()==null){
	                throw new RenderingViewException("No data for rendering");
	            }
	            response.setContentType("Content-Type:text/html;charset="+JBeer.applicationEncode);
	            Writer writer = response.getWriter();
	            writer.write(modelView.getContent());
	            writer.flush();
	            writer.close();
	        }catch(Exception e){
	            throw new RenderingViewException(e);
	        }
	        }
}
